package com.genius.feign;

import com.genius.constant.SecurityConstants;
import com.genius.core.JSONResult;
import com.genius.monitor.pojo.LoginLog;
import com.genius.monitor.pojo.OperationLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import javax.validation.Valid;

@FeignClient("monitor-service")
public interface LogServiceFeign {

    /**
     * 保存操作日志
     * @param operationLog 操作日志信息
     * @param fromSource 访问来源
     * @return 结果
     */
    @PostMapping("/operationLog/insertOperationLog")
    public JSONResult insertOperationLog(@Valid @RequestBody OperationLog operationLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String fromSource);

    /**
     * 保存登陆日志
     * @param loginLog 登陆日志信息
     * @param fromSource 访问来源
     * @return 结果
     */
    @PostMapping("/loginLog/insertLoginLog")
    public JSONResult insertLoginLog(@Valid @RequestBody LoginLog loginLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String fromSource);
}
